package com.dyw.blog.controller;

import com.dyw.blog.service.CommentService;
import com.dyw.blog.vo.Result;
import com.dyw.blog.vo.params.CommentParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author Devil
 * @create 2022-02-11 21:29
 */
@RestController
@RequestMapping("comments")
public class CommentsController {
    @Autowired
    private CommentService commentService;

    ///comments/article/{id}
    @GetMapping("article/{id}")
    public Result comment(@PathVariable("id") Long id){
        return commentService.viewCommentsByArticleId(id);
    }


    //comments/create/change
    @PostMapping("create/change")
    public Result comment(@RequestBody CommentParam commentParam){
        return commentService.comment(commentParam);
    }


}
